﻿<%@ Application Language="C#" %>

<script runat="server">
    static log4net.ILog log;
    
    void Application_Start(object sender, EventArgs e) 
    {
        // Code that runs on application startup
        // Code that runs on application startup
        AsyncCore.init();
        log4net.Config.XmlConfigurator.Configure();
        String path;
        path = "/";
        log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(Server.MapPath(path + "App_Data/log.config")));
        log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
        log.Info("Application_Start");
        

    }
    
    void Application_End(object sender, EventArgs e) 
    {
        //  Code that runs on application shutdown
        AsyncCore.stop();

    }
        
    void Application_Error(object sender, EventArgs e) 
    { 
        // Code that runs when an unhandled error occurs
        log.Error("AppError: " + e.ToString());
        Exception err = Server.GetLastError();
        log.Error("AppError: " + err.ToString());        
    }

    void Session_Start(object sender, EventArgs e) 
    {
        // Code that runs when a new session is started

    }

    void Session_End(object sender, EventArgs e) 
    {
        // Code that runs when a session ends. 
        // Note: The Session_End event is raised only when the sessionstate mode
        // is set to InProc in the Web.config file. If session mode is set to StateServer 
        // or SQLServer, the event is not raised.
        //MindTouch.Dream.

    }
       
</script>
